Keywords in Java
Keywords are reserved words in Java that have special meaning to the compiler. They cannot be used as identifiers for variables, classes, methods, or other constructs.
lists the keywords in Java:
Keywords list
abstract |
assert |
boolean |
break |
byte |
case |
catch |
char |
class |
const |
continue |
default |
do |
double |
else |
enum |
extends |
false |
final |
finally |
float |
for |
goto |
if |
implements |
import |
instanceof |
int |
interface |
long |
native |
new |
null |
package |
private |
protected |
public |
return |
short |
static |
strictfp |
super |
switch |
synchronized |
this |
throw |
throws |
transient |
true |
try |
void |
volatile |
while |
The keywords in Java are case-sensitive. For example, class is a different keyword from Class.
Keywords cannot be used as identifiers for variables, classes, methods, or other constructs. For example, you cannot declare a variable named class.
It is important to be aware of the keywords in Java when writing code. Using a keyword as an identifier can cause errors in your code.